﻿using System;
using Md.Api.DDD.Validation;

namespace Md.Api.DDD.EntityValidation;
/// <summary>
/// 时间戳
/// </summary>
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false)]
public class TimesTampAttribute : EntityValidationAttribute
{
    public TimesTampAttribute(MessageType messageType, params object[] args) :
            base(messageType, args)
    {
    }

    public override bool IsValid(object? value)
    {
        if (value == null)
            return false;
        else
            return ValidationHelp.CheckDateTimeFormat((string)value);
    }
}

